import Vue from "vue";

import VueRouter from "vue-router";
import Login from "@/views/login/index.vue"
import Layout from "@/components/Layout.vue"
import Main from "@/views/main"
import Member from "../views/member"
import Supplier from "../views/supplier"
import Goods from "../views/goods"
import Staff from "../views/staff"
import Purchase from "../views/purchase"
import Dispatch from "../views/dispatch"
import Logs from "../views/logs"


Vue.use(VueRouter);


const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    redirect:'/main',
    children: [
      {
        path: '/main',
        component: Main,
        meta: {title: '首页'}
      },
      {
        path: '/member',
        component: Member,
        meta: {title: '会员管理'}
      },
      {
        path: '/supplier',
        component: Supplier,
        meta: {title: '供应商管理'}
      },
      {
        path: '/goods',
        component: Goods,
        meta: {title: '商品管理'}
      },
      {
        path: '/staff',
        component: Staff,
        meta: {title: '员工管理'}
      },
      {
        path: '/purchase-list',
        component: Purchase,
        meta: {title: '进货单管理'}
      },
      {
        path: '/dispatch-bill',
        component: Dispatch,
        meta: {title: '发货单管理'}
      },
      {
        path: '/logs',
        component: Logs,
        meta: {title: '系统日志'}
      }
    ]
  }
];

const router = new VueRouter({
  //mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
